package test;

import java.awt.BorderLayout;
import java.awt.Color;

import javax.swing.JFrame;

import challengeGUI.ElementCountGUI;
import challengeGUI.FindTheSameGUI;
import elements.GameElement;

public class FindTheSameGUITEST extends JFrame {

	private static final long serialVersionUID = -5006951038129869893L;
	public FindTheSameGUI gui;
	private GameElement element;

	public static void main(String[] args) {
		FindTheSameGUITEST test = new FindTheSameGUITEST();
		test.setSize(640, 360);
		test.setLocationRelativeTo(null);
		test.setVisible(true);
		test.setTitle("OMFG!");

		test.run();
	}

	public FindTheSameGUITEST() {
		super();
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);

		this.setLayout(new BorderLayout());

		gui = new FindTheSameGUI(null);
		//		gui.setForeground(Color.BLACK);
		//		gui.setBackground(Color.BLACK);
		this.add(gui,BorderLayout.CENTER);


		//		init();
	}

	public void run() {
		gui.newRound();

		int counter = 0;
		while(true) {
			try {
				Thread.sleep(2000);
				//				System.out.println("Penis");
			} catch(InterruptedException e) {
				System.out.println("Trolololoooooo!");
			}
			gui.update();
			counter++;
			
			if(counter == 6)  {
				try {
					Thread.sleep(1000);
					//				System.out.println("Penis");
				} catch(InterruptedException e) {
					System.out.println("Trolololoooooo!");
				}
				
				gui.reveal(100);
				break;
			}
		}
	}

	//	public void init() {
	//		Random tmp = new Random(System.currentTimeMillis());
	//		
	//		animator.setForegroundPainting(true);
	//		
	//		//Mover
	//		GameMover mover = new SimpleMover(0, /*tmp.nextInt(4)+*/1);
	//		mover.setYMult(tmp.nextInt(4) + 1);
	//		
	//		//Element
	//		element = Animator.factory.newGameSquare(mover, 30);
	//		element.setXY(this.getX() + 200 - element.getWidth()/2, this.getY() + 10);
	//		animator.add(element);
	//	}
	//	
	//	public void run() {
	//		animator.run();
	//	}
	//	
	//	public void paint(Graphics g) {
	//		// Draws the Box
	//		// 1/8 Width from the border
	//		// 3/4 Height from the top and 1/8 Height to the bottom
	//		int y = this.getWidth()/8, x = this.getHeight()/4;
	//		g.drawRect(y, 3*x, 6*y, x/2);
	//	}

}
